<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
    <title>stomp</title>
    <script src="vendors/jquery-1.9.1.min.js"></script>
</head>

<body>
    Welcome<br/><input id="text" type="text" />
    <button onclick="send(100)">登录</button>
    <button onclick="send(110)">好友列表</button>
    <button onclick="send(111)">添加好友</button>
    <button onclick="send(112)">移除好友</button>
    <button onclick="send(113)">新建群</button>
    <button onclick="send(114)">邀请入群</button>
    <button onclick="send(115)">群列表</button>
    <button onclick="send(116)">确认好友申请</button>
    <button onclick="send(117)">新的好友</button>
    <hr/>
    <button onclick="send(120)">进入房间</button>
    <button onclick="send(121)">发包</button>
    <button onclick="send(122)">抢包</button>
    <button onclick="send(124)">消息列表</button>
    <hr/>
    <div id="message"></div>
</body>

<script type="text/javascript">

function send(act,rob){
	var fd = text.value.split(" ");
	var data = {}
	if(act == 100){
		data = {userName:fd[0]};
	}else if(act == 110){
		data = {};
	}else if(act == 111){
		data = {uid:fd[0]};
	}else if(act == 112){
		data = {uid:fd[0]};
	}else if(act == 113){
		data = {title:fd[0]};
	}else if(act == 114){
		data = {gid:fd[0],uid:fd[1]};
	}else if(act == 115){
		data = {};
	}else if(act == 116){
		data = {msgId:fd[0]};
	}else if(act == 117){
		data = {};
	}else if(act == 120){
		data = {roomId:fd[0]};
	}else if(act == 121){
		data = {roomId:fd[0],coin:fd[1],num:fd[2],lei:fd[3]};
	}else if(act == 122){
		data = {packId:fd[0]};
	}else if(act == 124){
		data = {roomId:fd[0]};
		
	}
	var msg = JSON.stringify(data);
	$.post('game/api/'+act,{'data':msg},function(data){
		log("收到消息:"+JSON.stringify(data));
	});
	log("发送消息:"+msg);
}
function log(msg){
	message.innerHTML = message.innerHTML+"<br>"+msg;
}

</script>

</html>